<script setup lang="ts">
import type { ColumnsInfo } from '@/types/loginType'
import { useSearchInputStroe } from '@/stores/searchInputStore'
const { searchKeyWords } = useSearchInputStroe()
defineProps<{
  columns: ColumnsInfo[]
}>()
</script>

<template>
  <ul id="clumns">
    <li v-for="item in columns" :key="item.id" @click="searchKeyWords(item.name, 0)">
      <div>
        <img class="clumnsImg" :src="item.img" alt="" />
      </div>
      <div>
        <p class="top">
          <b>{{ item.name }}</b>
        </p>
        <p class="center">
          <b>
            <Avatar class="svg" />
            <span>{{ item.followed }}</span>
          </b>
          <b>
            <Document class="svg" />
            <span>{{ item.total }}</span>
          </b>
        </p>
      </div>
    </li>
  </ul>
</template>

<style scoped>
.clumnsImg {
  display: inline-block;
  vertical-align: middle;
  width: 56px;
  height: 56px;
  margin: 8px;
  border-radius: var(--radius);
}
#clumns {
  min-height: 200px;
  padding: 10px;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  grid-auto-rows: 72px;
  gap: 10px;
  > li:hover {
    outline: 2px solid var(--color3);
    border-color: var(--color3);
    color: var(--color3);
  }
  > li:active {
    background-color: var(--color2);
  }
  > li {
    cursor: pointer;
    border-radius: var(--radius);
    overflow: hidden;
    background-color: var(--color2);
    border-color: var(--color-font);
    color: var(--color-font);
    > div:nth-child(2) {
      height: 72px;
      width: calc(100% - 72px);
      box-sizing: border-box;
    }
    > div {
      display: inline-block;
      vertical-align: middle;
      > p {
        padding: 2px 0;
        > span {
          display: inline-block;
          vertical-align: middle;
        }
      }
    }

    .top {
      height: 30px;
      line-height: 30px;
      b {
        display: block;
        text-align: center;
        max-width: 200px;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        color: inherit;
      }
    }
    .center {
      box-sizing: border-box;
      height: 28px;
      box-sizing: border-box;
      display: flex;
      justify-content: space-around;
      align-items: center;
      color: inherit;
      > b {
        color: inherit;
        > .svg {
          vertical-align: middle;
          width: 16px;
          height: 16px;
          padding: 0 4px;
          display: inline-block;
          vertical-align: middle;
          color: inherit;
        }
        > span {
          vertical-align: middle;
          max-width: 56px;
          overflow: hidden;
          text-overflow: ellipsis;
          color: inherit;
        }
      }
    }
  }
}
</style>
